fs = require 'fs'
path = require 'path'
pid = null
try
	pid = fs.readFileSync 'process.pid'
catch err
	console.log err

process.chdir __dirname+'/server'

if pid
	try
		process.kill pid, 'SIGKILL'
	catch err
		console.log err

setTimeout ()->
	require('child_process').exec 'nodemon server.coffee 8080'
,2000